import logging
from redis import StrictRedis
class Config():
    SECRET_KEY ="1234567890"

    SQLALCHEMY_DATABASE_URI = "mysql://root:mysql@127.0.0.1:3306/manage"
    SQLALCHEMY_TRACK_MODIFICATIONS =True

    REDIS_HOST = "127.0.0.1"
    REDIS_PORT = 6379
    #session的储存方式 redis
    SESSION_TYPE ="redis"
    #session的储存对象 域名 端口
    SESSION_REDIS =StrictRedis(host=REDIS_HOST,port=REDIS_PORT)
    #设置签名 加密
    SESSION_USE_SIGNER =True
    #设置session的永久保存
    SESSION_PERMANENT =False
    #保存时间
    PERMANENT_SESSION_LIFETIME =86400 * 2

    SQLALCHEMY_COMMIT_ON_TEARDOWN = True


class DevelopConfig(Config):
    DEBUG = True
    LOG_LEVEL = logging.DEBUG


class ProductConfig(Config):
    DEBUG = False
    LOG_LEVEL = logging.ERROR

class TestingConfig(Config):
    DEBUG = True

config ={
    "develop": DevelopConfig,
    "product": ProductConfig,
    "testing": TestingConfig
}